package cn.iocoder.yudao.module.mqtt.dal.mysql.devicelatest;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mqtt.dal.dataobject.devicelatestflow.DeviceLatestFlowDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mqtt.controller.admin.devicelatestflow.vo.*;

/**
 * 设备最新信息 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DeviceLatestFlowMapper extends BaseMapperX<DeviceLatestFlowDO> {

    default PageResult<DeviceLatestFlowDO> selectPage(DeviceLatestFlowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceLatestFlowDO>()
                .eqIfPresent(DeviceLatestFlowDO::getDeviceKey, reqVO.getDeviceKey())
                .orderByDesc(DeviceLatestFlowDO::getId));
    }


    default List<DeviceLatestFlowDO> selectList(DeviceLatestFlowReqVO reqVO) {
        return selectList( new LambdaQueryWrapperX<DeviceLatestFlowDO>()
                .eqIfPresent(DeviceLatestFlowDO::getDeviceKey, reqVO.getDeviceKey())
                .inIfPresent(DeviceLatestFlowDO::getDeviceKey, reqVO.getDeviceKeys())
                .orderByDesc(DeviceLatestFlowDO::getId));
    }

}